home *** CD-ROM | disk | FTP | other *** search
/ Your Choice 3 / Your Choice Software Collection 3.iso / prgmming / swag05 / cursor.swg < prev    next >
Encoding:
Text File  |  1994-09-22  |  4.3 KB  |  1 lines

  1. SWAGOLX.EXE (c) 1993 GDSOFT  ALL RIGHTS RESERVED 00003                                                                           1      05-25-9408:03ALL                      GREG ESTABROOKS          cursor size attributes   SWAG9405            19     .]   π{π One way to do it is to change the cursor size attributes. Here are someπ routines I use and a little demo program I wrote for another user aπ while back(Gosh almost a year now<g>). Also if your doing a lot ofπ screen writing and either don't want the cursor to move or not beπ visible at all you might want to try looking into direct video memoryπ writes.π}ππPROGRAM CursorDemo;              (*  May 27/93, Greg Estabrooks     *)πUSES CRT;                        (*  For Readkey, Clrscr.           *)πCONSTπ     (* Define Cursor Value to make chaning cursor easier *)π    NoCursor      = $2000;π    DefaultCursor = $0607;π    BlockCursor   = $000A;πVARπ    Curs :WORD;                 (* Stores saved cursor value         *)π    Ch   :CHAR;ππPROCEDURE SetCursor( Cursor :WORD ); ASSEMBLER;π                     (* Routine to change the shape of the cursor    *)πASMπ  Mov AH,1                      (* Function to change cursor shape   *)π  Mov BH,0                      (* Set Page to 0                     *)π  Mov CX,Cursor                 (* Load new cursor Shape Value       *)π  Int $10                       (* Call Dos                          *)πEND;{SetCursor}ππFUNCTION GetCursor :WORD; ASSEMBLER;π                   (* Routine to return Cursor Shape                 *)πASMπ  Mov AH,3                      (* Function to return cursor shape   *)π  Mov BH,0                      (* Set Page to 0                     *)π  Int $10                       (* Call Dos                          *)π  Mov AX,CX                     (* Move Result to proper register    *)πEND;{GetCursor}ππBEGINπ  Clrscr;                       (* Clear the screen for demonstration*)π  Curs := GetCursor;            (* Save Current Cursor Value         *)π  Writeln('The Cursor is turned off');π  SetCursor( NoCursor );        (* Turn off the cursor               *)π  Ch := Readkey;                (* Pause to show user new cursor     *)π  Writeln('The Cursor is a block shape');π  SetCursor( BlockCursor );     (*  Set the cursor to a block        *)π  Ch := Readkey;π  Writeln('The Cursor is now the normal shape');π  SetCursor( DefaultCursor );   (* Set Default Cursor                *)π  Ch := Readkey;ππ  SetCursor( Curs );            (* Restore cursor to previous style  *)πEND.π                               2      05-25-9408:03ALL                      SEAN PALMER              Better Cursor Control    SWAG9405            9      .]   {πA much better more reliable method is just to set the CURRENT cursor's bitπ5 to disable it, then mask it back off again...π}πunit cursor; {Public domain, by Sean Palmer}ππinterfaceππvar maxSize:byte;ππ procedure cursorOn;π procedure cursorOff;π procedure setSize(scans:byte);  {set size from bottom, or 0 for off}π procedure detect;     {get max scan lines by reading current cursor}ππimplementationππprocedure cursorOn;assembler;asmπ mov ah,3; mov bh,0; int $10; and ch,not $20; mov ah,1; int $10;π end;ππprocedure cursorOff;assembler;asmπ mov ah,3; mov bh,0; int $10; or ch,$20; mov ah,1; int $10;π end;ππprocedure setSize(scans:byte);var t:byte;beginπ if scans=0 then t:=$20 else t:=maxSize-scans;π asm mov ah,1; mov bh,0; mov ch,t; mov cl,maxSize; dec cl; int $10; end;π end;ππ{call whenever you change text cell height}πprocedure detect;assembler;asm  {do NOT call while cursor's hidden}π mov ah,3; mov bh,0; int $10; inc cl; mov maxSize,cl;π end;ππbeginπ detect;π end.π                                               3      05-25-9408:10ALL                      LOU DUCHEZ               cursor hiding            SWAG9405            5      .]   πvar crstyp: word;ππprocedure cursoff;ππ{ Turns the cursor off.  Stores its format for later redisplaying. }ππbeginπ  asmπ    mov ah, 03hπ    mov bh, 00hπ    int 10hπ    mov crstyp, cxπ    mov ah, 01hπ    mov cx, 65535π    int 10hπ    end;π  end;ππprocedure curson;ππ{ Turns the cursor back on, using the cursor display previously stored. }ππbeginπ  asmπ    mov ah, 01hπ    mov cx, crstypπ    int 10hπ    end;π  end;ππ